package com.sdry.product.prod.controller;

import com.sdry.common.BaseController;
import com.sdry.common.TableDataInfo;
import com.sdry.product.prod.entity.LacquerInto;
import com.sdry.product.prod.entity.ProductTwoPaint;
import com.sdry.product.prod.service.ProductTwoPaintService;
import net.sf.json.JSONArray;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * 二遍漆
 *
 * @author makejava
 * @since 2020-03-05 15:13:02
 */
@Controller
@RequestMapping("productTwoPaint")
public class ProductTwoPaintController extends BaseController {
    /**
     * 服务对象
     */
    @Resource
    private ProductTwoPaintService productTwoPaintService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public ProductTwoPaint selectOne(Long id) {
        return this.productTwoPaintService.queryById(id);
    }

    /**
     * 展示上线
     * @return
     */
    @RequestMapping(value = "showProductTwoPaint")
    public String showLacquerInto() {
        return "/product/prod/productTwoPaint";
    }

    /**
     * 展示下线
     * @return
     */
    @RequestMapping(value = "showProductTwoPaintOut")
    public String showProductTwoPaintOut() {
        return "/product/prod/productTwoPaintOut";
    }

    /**
     * 分页查询二遍漆表
     * @param productTwoPaint 二遍漆表
     * @return TableDataInfo
     */
    @RequestMapping(value = "queryProductTwoPaintPage")
    @ResponseBody
    public TableDataInfo queryProductTwoPaintPage(ProductTwoPaint productTwoPaint,String delFlag) {
        logger.info("分页查询二遍漆表  productTwoPaint = {} "+ JSONArray.fromObject(productTwoPaint));
        List<ProductTwoPaint> lacquerIntoList = productTwoPaintService.queryProductTwoPaintPage(productTwoPaint);
        Long total = productTwoPaintService.queryProductTwoPaintTotal(productTwoPaint);
        return getDataTable(lacquerIntoList,total);
    }

}